/*
 * @Author: 火红色祥云 809880192@qq.com
 * @Date: 2023-10-04 18:47:38
 * @LastEditors: 火红色祥云 809880192@qq.com
 * @LastEditTime: 2023-10-04 22:17:13
 * @FilePath: /imx6ull-app/26_Sqlite3/db.h
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#ifndef __DB_H_
#define __DB_H_
#include <stdio.h>
#include "sqlite3.h"
#include <string.h>

typedef struct _DB_ROW_DATA{
    int RTE_ID;
    int Value;
    int Defalult_Value;
    int Max_Value;
    int Min_Value;
    int Offset;
}DB_DataRow;

int DB_OpenDB(const char *DB_FileName,sqlite3 **DB_Handle);
int DB_CloseDB(sqlite3 *DB_Handle);

int DB_CreatDBTable(sqlite3 *DB_Handle,char *TableName);
int DB_ReplaceDBData(sqlite3 *DB_Handle,char *TableName,DB_DataRow dataRow);
int DB_InsertDBData(sqlite3 *DB_Handle,char *TableName,DB_DataRow dataRow);
int DB_UpdateDBData(sqlite3 *DB_Handle,char *TableName,int RTE,int Value);
int DB_SelectDBData(sqlite3 *DB_Handle,char *TableName,int RTE_ID,DB_DataRow *dataRow);
int DB_SelectDBRangeData(sqlite3 *DB_Handle,char *TableName,int RTE_StartID,int Num,DB_DataRow dataRow[]);

#endif
